<?php
/*
AppID=PRESTOJ16H32DKB9J858R57FJ254J1
DevID=Z1AIRF6G7HKMN75UO8FHQ5JJW4C58W
CertID=Z3552131JT1$28HV1122W-31ZDLW4W
Token=AgAAAA**AQAAAA**aAAAAA**QBe0Sg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6wHmIWlC5GAog+dj6x9nY+seQ**Ix0AAA**AAMAAA**P2++qwIq+/pIklC+qahhJXQTpJM2pss/byTJEmdgk1zM6tTdBWo+w4F79fn3cNnNtwK1zgXMU4jUAg+nbE63nWfO+LiNbvidyNFOUGiXsyA6ogzyb/3AoInT5yZX5H4SbsArtzpqWgOFDUshH+xKpNctR4pmZkch0aaWIgg+aQod9fwJhYvZx4XL3YglWBdJMA/h2i5rSfe5iCDy4NZPrrC/y9OMCCjJsr4Vtwyiw4k7mUkgyqnerrbY7BWJEjk2Y9+j/yiQbcQd/t5t9sUNGsuXKi/gm2A0ugIrLjTIU4yR82fj7WVj8mJyZnSPCh/LriUKHr6wzjlP/lrRws/1O0gdzetiRegWbEW+eSv5RBeS9oIbY0M2zsTCUNIuTPbnjCI/88IWMTyejuQx8+PMOhyOidf154EhI1XcMi1IefBygNGQDVxQgZm0tPR4vd0KB/DMgvTBUYQx+I7g43x0YuDyQh0ehQKnjHusSwBYxL+KZmj6CC0qOb1aKmNU2yjUoEzkTJYEuoIVKXGS7j1H+ty8OzRfXH9z18gXyMQsOilQfSeUcNI2ux46AufWVt4vUxI+JaxHe0w4FnEfJ0e4AtTqkN7802l1qCgbxgZhsiGIEeHz8hCGR6oCJmrvFiMFZMhp5oL3Whf3xWWcbQfRQPmEB92bZgO7yEiTy58bqU9CaBbyvsy1UaZUyZ6A4cX8ksmEyREgMCkLBqv9jjgQqwbeAl/pP7350wEIdwkUOKjynyDF8QbW8vwN3rDR299I
*/
$validkeys = array('blazincart');
$datekey = $_POST['timestamp'];
$programkey = $_POST['key'];

class Cipher {
    private $securekey, $iv;
    function __construct($textkey) {
        $this->securekey = hash('sha256',$textkey,TRUE);
        $this->iv = mcrypt_create_iv(32);
    }
    function encrypt($input) {
        return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $this->securekey, $input, MCRYPT_MODE_ECB, $this->iv));
    }
    function decrypt($input) {
        return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $this->securekey, base64_decode($input), MCRYPT_MODE_ECB, $this->iv));
    }
}

$data = date('His');
$cipher = new Cipher($validkeys.$data);

$encryptedtext = $cipher->encrypt("hide me");
echo "->encrypt = $encryptedtext<br />";

$decryptedtext = $cipher->decrypt($encryptedtext);
echo "->decrypt = $decryptedtext<br />";

var_dump($cipher);
?>
